﻿using System;
using System.Collections.Generic;
using System.Text;
using limpalex.bbparser.Interfaces;

namespace limpalex.bbparser.Attributes
{
    [Serializable]
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
    public sealed class ConverterAttribute : Attribute
    {
        private readonly Type _converter;
        public ConverterAttribute(Type type)
        {
            if ( Array.Exists(type.GetInterfaces(), t => t == typeof(IValueConverter)))
                _converter = type;
            else
                throw new ArgumentException("conterter type does not implement IValueConverter interface");
        }
        public Type Converter { get { return _converter; } }
    }
}
